package com.easipass.framework.eirframeworkstream;

import com.easipass.framework.eirframeworkbeanshell.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;

@EnableBinding(MessageProcess.class)
public class MessageRecieve {

    @Autowired
    private CoreFeignService croeFeignService;

    @StreamListener(MessageProcess.OUTPUT_SOURCE_MESSAGE)
    public void recieveSource(Message message) {
        croeFeignService.process(message.getServiceName(), message.getName(), message.getContent().toString());
    }

    @StreamListener(MessageProcess.OUTPUT_SINK_MESSAGE)
    public void recieveSink(Message message) {
        System.out.println("stream sink message recieve:" + message);
    }
}
